import { BrowserModule } from '@angular/platform-browser';
import { NgModule } from '@angular/core';
import { RouterModule, Routes, Router } from '@angular/router';
import { BrowserAnimationsModule } from '@angular/platform-browser/animations';
import { HttpModule, Http, XHRBackend, RequestOptions } from '@angular/http';



// 自定义icon
import { MatIconModule, MatIconRegistry } from '@angular/material';
//第三方插件// lib
// import { FlexLayoutModule } from "@angular/flex-layout";
// import { MaterialModule } from '@angular/material';
// import { JasperoAlertsModule } from '@jaspero/ng2-alerts';
// import { BusyModule, BusyConfig } from './modules/busyModule';

// import { NgxPaginationModule } from './modules/ngx-pagination/ngx-pagination.module';


import { ShareModule } from './share.module';

// 自定义模块

import { AppComponent } from './app.component';//root

import { NavbarComponent } from './navbar/navbar.component';

import { ToastyService } from './modules/ng2-toasty';

// services
// utils// 自定义服务
import { AuthGuard } from './utils/authGuard';
import { httpFactory } from "./utils/http.factory";
import { AuthService } from './utils/authService';
import { Util } from './utils/util';

import { Scope } from './utils/emit';


// components
import { ComponentsModule } from './components/components.module';
// pipes
import { PipesModules } from './pipes/pipes.module';


import { AppSettings } from './app.settings';
// import { ExtraLib } from

// directives
import { NgEchartDirective } from './directives/ng-echart/ng-echart.directive';

import { GoDetailDirective } from './directives/go.detail.directive';

import { stSortDirective } from './directives/st-sort.directive';

import { FixedTopDirective } from './directives/fixed-top.directive';

// app route
import { AppRoutingModule, routingPages, routingPagesComponents } from './app.router.module';


// hash
import {HashLocationStrategy, LocationStrategy} from '@angular/common';
 // {provide: LocationStrategy, useClass: HashLocationStrategy}
@NgModule({
  declarations: [
    AppComponent,
    NavbarComponent,

    routingPages,
    routingPagesComponents,

    // directives
    NgEchartDirective,
    GoDetailDirective,
    stSortDirective,
    FixedTopDirective,
    
    // pipes
    // TranslatePipe
  ],
  imports: [
    BrowserModule,
    BrowserAnimationsModule,
    HttpModule,
    AppRoutingModule,
    PipesModules,
    ComponentsModule,
    ShareModule
  ],
  providers: [
    Scope,
    Util,
    AuthService,
    {provide: LocationStrategy, useClass: HashLocationStrategy},
    { provide: Http, useFactory: httpFactory, deps: [XHRBackend, RequestOptions, Router, ToastyService] },
    AppSettings,
    
  ],
  bootstrap: [AppComponent]
})
export class AppModule {
  constructor(mdIconRegistry: MatIconRegistry) {
    mdIconRegistry.registerFontClassAlias('fontawesome', 'fa');
    mdIconRegistry.setDefaultFontSetClass('fa');
  }

}
